# # 加了星号 * 的参数会以元组(tuple)的形式导入，存放所有未命名的变量参数。
def printinfo(*arg1):
    "打印任何传入的参数"
    print(*arg1)
    # print(vartuple)  # (60, 50) 没有解包,打印出来的是元祖
    # print(*vartuple)  # 60, 50 加上*就会解包,打印出来的是元素

# 调用printinfo 函数
printinfo(70, 60, 50)
#
#
# # 加了两个星号 ** 的参数会以字典的形式导入。
def printinfo(**vardict):
    "打印任何传入的参数"
    print("输出: ")
    # print(arg1)
    print(vardict)  #  {'b': 3, 'a': 2}
    # print(**vardict)  # 2 ,3   ,得遍历了字典才能打印出来
    # for k in vardict:
    #     print(k, '=',vardict[k])
    print([vardict[k] for k in vardict])
# 调用printinfo 函数
printinfo(a=2, b=3)
#
# s = lambda a, b : a + b
# print(s(2,32))
#
#
# total = 0  # 这是一个全局变量
# ##########
# def sum(arg1, arg2):
#     total = arg1 + arg2  # total在这里是局部变量.
#     print("函数内是局部变量 : ", total)
#     return total
#
# sum(10, 20)
# print("函数外是全局变量 : ", total)
#
# #######
# # num = 1
# # def fun1():
# #     global num  # 需要使用 global 关键字声明
# #     print(num)
# #     num = 123
# #     print(num)
# # fun1()
# # print(num)   # 此时num已经更改为123
#
# ######
# def outer():
#     num = 10
#     def inner():
#         # global num   # nonlocal关键字声明
#         nonlocal num
#         num = 100
#         print('inner',num)
#     inner()
#     print(num)    # global 时返回10;       nonlocal  100
# outer()
# ######
# l = [1,3,6,33]
# print(l.index(33))
#
# #####   3x4
# matrix = [
#     [1, 2, 3, 4],
#     [5, 6, 7, 8],
#     [9, 10, 11, 12],
#     ]
#
# print([[row[i] for row in matrix] for i in range(4)])
#
# for i in range(4):
#     for row in matrix:
#         row[i]
#         print(row[i])

#######
# for i in range(5):
#     # print(i,i*i, i**3)
#     print('{0:2d}{1:4d}{2:4d}'.format(i, i*i*2, i**3))

# a = '23.34'
# print(a.zfill(50))

##### self理解
# class Test(object):
#     def prt(self):
#         print(self)                 #<wo.参数问题.Test object at 0x7f496bbc1710>
#         print(self.__class__)       #<class 'wo.参数问题.Test'>
#
#
# t = Test()
# t.prt()
#
# class Test:
#     def prt(a):
#         print(a)                #<wo.参数问题.Test object at 0x7f496bbc17f0>
#         print(a.__class__)      #<class 'wo.参数问题.Test'>
#
#
# t = Test()
# t.prt()
# __weight = 0      私有属性

